package main

import "fmt"

type LimitType interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | string
}

func limitFanxing[T LimitType](val T) T {
	return val
}

func limitOnlyFanxing[T int](val T) T {
	return val
}

func main() {

	a2 := 99
	limitFanxing(a2)

	a3 := [4]string{"a", "b", "c"}
	fmt.Println(a3)

	/**
	Cannot use [4]string as the type LimitType
	Type does not implement constraint LimitType because type is not included in type set (int, int8, int16, int32, int64, …)
	*/
	//limitFanxing(a3)

	limitOnlyFanxing(a2)
	//limitOnlyFanxing(a3) //Cannot use [4]string as the type interface{ int }
}
